package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * 微信支付订单访问数据库
 * @作者 李宇鹏
 * @版本 v1.0
 * @创建时间 2023-04-11 13:44:15
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class GoodsOrderDao{

  private final DaoHandle dao;

  public GoodsOrderDao(final DaoHandle dao){
    this.dao = dao;
  }

  public int add(final PageFormData formData){
    return dao.execute("goods_order.add",formData);
  }

  public int edit(final PageFormData formData){
    return dao.execute("goods_order.edit",formData);
  }

  public Long queryExistById(final long kid){
    return dao.queryForLong("goods_order.queryExistById",kid);
  }

  public HashMap<String,Object> queryById(final long kid){
    return dao.queryForHashMap("goods_order.queryById",kid);
  }

  public List<HashMap<String,Object>> getOrderDetails(final long kid){
    return dao.queryForListHashMap("goods_order.getOrderDetails",kid);
  }

  public int delById(final long kid){
    return dao.execute("goods_order.delById",kid);
  }

  public int delByKeys(final long[] list){
    return dao.execute("goods_order.delByKeys",list);
  }

  public List<HashMap<String,Object>> getListData(final PageFormData formData){
    return dao.queryForListHashMap("goods_order.listData",formData);
  }

  public Integer getListTotal(final PageFormData formData){
    return dao.queryForInteger("goods_order.listTotal",formData);
  }

  public List<HashMap<String,Object>> listOrderCoupon(final long outTradeNo){
    return dao.queryForListHashMap("goods_order.listOrderCoupon",outTradeNo);
  }

  public int editAvailable(final long out_trade_no){
    return dao.execute("goods_order.editAvailable",out_trade_no);
  }

  public int updateAvailable(final HashMap<String,Object> params){
    return dao.execute("goods_order.updateAvailable",params);
  }
}